/*
 * Copyright (c) 2007-2020 西安交通信息投资营运有限公司 版权所有
 */

package com.xci.edu.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.github.lvyanyang.core.BaseEntity;
import com.github.lvyanyang.core.Const;
import com.github.lvyanyang.core.XCI;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 学习验证问题
 * @author 吕艳阳 lvyanyang@xci96716.com
 * @since 2020-11-24 10:19:12
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "学习验证问题")
public class EduValidateQuestion extends BaseEntity {
    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ExcelIgnore
    @Excel(name = "主键", width = 20d)
    @ApiModelProperty(value = "主键", position = 1)
    private Long id;

    /**
     * 标题
     */
    @NotBlank(message = "标题不能为空")
    @Length(max = 200, message = "标题长度不能超过{max}个字符")
    @Excel(name = "标题", width = 20d)
    @ApiModelProperty(value = "标题", required = true, position = 2)
    private String name;

    /**
     * 选项A
     */
    @NotBlank(message = "选项A不能为空")
    @Length(max = 100, message = "选项A长度不能超过{max}个字符")
    @Excel(name = "选项A", width = 20d)
    @ApiModelProperty(value = "选项A", required = true, position = 3)
    private String optionA;

    /**
     * 选项B
     */
    @NotBlank(message = "选项B不能为空")
    @Length(max = 100, message = "选项B长度不能超过{max}个字符")
    @Excel(name = "选项B", width = 20d)
    @ApiModelProperty(value = "选项B", required = true, position = 4)
    private String optionB;

    /**
     * 选项C
     */
    @Length(max = 100, message = "选项C长度不能超过{max}个字符")
    @Excel(name = "选项C", width = 20d)
    @ApiModelProperty(value = "选项C", position = 5)
    private String optionC;

    /**
     * 选项D
     */
    @Length(max = 100, message = "选项D长度不能超过{max}个字符")
    @Excel(name = "选项D", width = 20d)
    @ApiModelProperty(value = "选项D", position = 6)
    private String optionD;

    /**
     * 正确答案
     */
    @NotBlank(message = "正确答案不能为空")
    @Length(max = 100, message = "正确答案长度不能超过{max}个字符")
    @Excel(name = "正确答案", width = 20d)
    @ApiModelProperty(value = "正确答案", required = true, position = 7)
    private String answer;

    /***
     * 是否有c选项
     */
    @ApiModelProperty("是否有c选项")
    public Boolean getIfOptionC() {
        if (!XCI.isEmpty(this.optionC)){
            return true;
        }else{
            return false;
        }
    }

    /***
     * 是否有d选项
     */
    @ApiModelProperty("是否有d选项")
    public Boolean getIfOptionD() {
        if (!XCI.isEmpty(this.optionD)){
            return true;
        }else{
            return false;
        }
    }
}
